package com.itheima.springboot.config;

import com.itheima.springboot.conditional.Condutional_Class;
import com.itheima.springboot.domain.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
//Configuration 这个类为构造方法
@Configuration
public class UserConfig {

    //扫描并创建user的bean
    @Bean
    //前提条件要满足Condutional_Class内的方法，返回false创建user的bean不存在则不创建
    @Conditional(Condutional_Class.class)
    public User user(){

        return new User();
    }


}
